package tq.com.tqteacher.view.viewhold;

import android.view.View;
import android.widget.Button;

import tq.com.tqteacher.R;
import tq.com.tqteacher.model.TQPublishType;

public class TQPublishSaveButtonViewHold {
    private View mParent;
    private Button mSave;
    private Button mPublish;

    public TQPublishSaveButtonViewHold(View pView){
        mParent = pView;

        if(mParent == null) return;

        mSave = mParent.findViewById(R.id.save);
        mPublish = mParent.findViewById(R.id.publish);

        if(TQPublishType.getTQOpenFrom() == TQPublishType.TQOpenFrom.optimize){
            mPublish.setText("保存并同步更新");
        }else{
            mPublish.setText("发布");
        }
    }

    public void setSaveClickListener(View.OnClickListener pOnClickListener){
        mSave.setOnClickListener(pOnClickListener);
    }

    public void setPublishClickListener(View.OnClickListener pClickListener){
        mPublish.setOnClickListener(pClickListener);
    }

    public void setAlreadyPublish(){
        mPublish.setText("已发布");
        mPublish.setEnabled(false);
    }

}
